home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_02_02
/
2n02046a
< prev
next >
Wrap
Text File
|
1990-12-29
|
3KB
|
91 lines
#define RECEIVE_TIMEOUT 0 /* no timeout */
#define SEND_TIMEOUT 0
/* flags included for clarity */
#define CLIENT 0
#define SERVER 1
#define FIRST 0
#define NEXT 1
/* NetBIOS commands */
#define NCB_ADD_GROUP_NAME 0x36
#define NCB_ADD_NAME 0x30
#define NCB_CALL 0x10
#define NCB_CANCEL 0x35
#define NCB_CHAIN_SEND 0x17
#define NCB_CHAIN_SEND_NO_ACK 0x72
#define NCB_DELETE_NAME 0x31
#define NCB_FIND_NAME 0x78
#define NCB_HANG_UP 0x12
#define NCB_LAN_STATUS_ALERT 0xF3
#define NCB_LISTEN 0x11
#define NCB_RECEIVE 0x15
#define NCB_RECEIVE_ANY 0x16
#define NCB_RECEIVE_BROADCAST_DATAGRAM 0x23
#define NCB_RECEIVE_DATAGRAM 0x21
#define NCB_RESET 0x32
#define NCB_SEND 0x14
#define NCB_SEND_BROADCAST_DATAGRAM 0x22
#define NCB_SEND_DATAGRAM 0x20
#define NCB_SEND_NO_ACK 0x71
#define NCB_SESSION_STATUS 0x34
#define NCB_STATUS 0x33
#define NCB_TRACE 0x79
#define NCB_UNLINK 0x70
/* NetBIOS command flags */
#define WAIT 0x00
#define NO_WAIT 0x80
/* NetBIOS return values */
#define NO_NETBIOS 0x00
#define INVALID_NAME 0xFF
struct net_control_block
{
char command;
char retcode;
char lsn; /* logical session number */
char number; /* application name table entry */
char *buffer;
unsigned int length; /* buffer length */
char r_name[16];
char l_name[16];
char rto; /* receive time out */
char sto; /* send time out */
void *post; /* post routine location */
char adapter; /* adapter number */
char complete;
char reserved[14];
};
struct session_status
{
char number; /* name table entry */
char number_of_sessions;
char outstanding_receive_datagram;
struct
{
char session_number;
char state;
char l_name[16];
char r_name[16];
char outstanding_receive;
char outstanding_send;
} session;
};
/* function prototypes */
void init_ncb(struct net_control_block *ncb);
void int_netbios(struct net_control_block *ncb);
unsigned int init_netbios(char *name);
unsigned int shutdown_netbios(char *name);
int dg_write(unsigned int number, char *destination,
char *buffer, int length);
int dg_read(unsigned int number, char *from,
char *buffer, int length);
int max_dg();